package top.infopub.job.quartz.exec;


import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import top.infopub.job.fia.service.FundsPlanService;
import top.infopub.job.quartz.exec.base.BaseJob;
import top.infopub.util.DateUtil;
import top.infopub.util.SpringContext;


/**
 * 财务-月度资金计划，汇总项目公司和直属项目公司金额，累计到对应的区域公司和总部上
 *
 */
public class FiaFundsPlanSummaryJob extends BaseJob {
    private static FundsPlanService fundsPlanService;

    static {
        fundsPlanService = SpringContext.getBean(FundsPlanService.class);
    }

    public FiaFundsPlanSummaryJob() {}

    @Override
    public void execute(JobExecutionContext context)
        throws JobExecutionException {
        try {
            String start = DateUtil.currentDateDef();
            log.info("FiaFundsPlanSummaryJob开始时间：{}", start);
            fundsPlanService.fundsPlanSummary();
            String end = DateUtil.currentDateDef();
            log.info("FiaFundsPlanSummaryJob结束时间：{}", end);
            logSucceed("月度资金计划汇总执行完成，开始时间：" + start + "，结束时间：" + end);
        }
        catch (Exception e) {
            log.error("月度资金计划汇总任务执行error", e);
            logFail(e, true);
        }
    }
}
